# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: Adrian Sampson <adrian@radbox.org>

pkgname=beets
pkgver=1.6.0
pkgrel=6
pkgdesc='Flexible music library manager and tagger'
arch=(any)
url=https://beets.io/
license=(MIT)
depends=(
  python-confuse
  python-jellyfish
  python-mediafile
  python-munkres
  python-musicbrainzngs
  python-reflink
  python-setuptools
  python-six
  python-unidecode
  python-yaml
)
makedepends=(
  git
  python-setuptools
  python-sphinx
)
checkdepends=(
  bash-completion
  imagemagick
  python-beautifulsoup4
  python-discogs-client
  python-flask
  python-mpd2
  python-nose
  python-nose-exclude
  python-pylast
  python-requests-oauthlib
  python-responses
  python-xdg
)
optdepends=(
  'bash-completion: Bash completion'
  'chromaprint: Chromaprint/Acoustid plugin'
  'ffmpeg: Convert, ReplayGain plugins'
  'gst-plugins-bad: Chromaprint/Acoustid, BPD, ReplayGain plugins'
  'gst-plugins-good: Chromaprint/Acoustid, BPD, ReplayGain plugins'
  'gst-plugins-ugly: Chromaprint/Acoustid, BPD, ReplayGain plugins'
  'gst-libav: Chromaprint/Acoustid, BPD, ReplayGain plugins'
  'gst-python: Chromaprint/Acoustid, BPD, ReplayGain plugins'
  'imagemagick: Thumbnails plugin'
  'python-beautifulsoup4: Lyrics plugin'
  'python-discogs-client: Discogs plugin'
  'python-flask: Web plugin'
  'python-gobject: ReplayGain plugin'
  'python-mpd2: MPDStats plugin'
  'python-pyacoustid: Chromaprint/Acoustid plugin'
  'python-pylast: LastGenre plugin'
  'python-requests: Chromaprint/Acoustid, BPD, FetchArt plugins'
  'python-requests-oauthlib: Beatport plugin'
  'python-xdg: Thumbnails plugin'
)
_tag=19371805e70c34e06ddd1ee3bd2e23a23827f845
source=(
  git+https://github.com/beetbox/beets.git#tag=${_tag}
  beet
)
b2sums=('SKIP'
        '1b36ba07d85f0fbcae0a3d8253ce2e5d7ecf8a17c6f0bb946579663de546d53cd4fe5da84ee8d880d7f95f48e66ef6010232a995d86d0c52b52218cd991a7782')

prepare() {
  cd beets
  git cherry-pick -n 5ae1e0f3c8d3a450cb39f7933aa49bb78c2bc0d9
  git cherry-pick -n d5f998b3120c8027986b55b9288b530fbf165fcc
  git cherry-pick -n 2106f471affd1dab35b4b26187b9c74d034528c5
}

pkgver() {
  cd beets
  git describe --tags | sed 's/^v//'
}

build() {
  cd beets
  python setup.py build sdist
}

check() {
  cd beets
  python -m nose \
    --exclude-test=test.test_ui.CompletionTest \
    --exclude-test=test.test_zero.ZeroPluginTest
}

package() {
  cd beets
  python setup.py install --root="${pkgdir}" --optimize=1
  install -Dm 644 ../beet -t "${pkgdir}"/usr/share/bash-completion/completions/
  install -Dm 644 extra/_beet -t "${pkgdir}"/usr/share/zsh/site-functions/
  install -Dm 644 man/beet.1 -t "${pkgdir}"/usr/share/man/man1/
  install -Dm 644 man/beetsconfig.5 -t "${pkgdir}"/usr/share/man/man5/
  install -Dm 644 LICENSE -t "${pkgdir}"/usr/share/licenses/beets/
}

# vim: ts=2 sw=2 et:
